﻿using DataLogical.TableClass;
using Biz.Utility;

namespace Biz.Treat
{
    public class Party : TreatContent
    {
        private tblTreatParty content = new tblTreatParty();

        public override decimal CalculateAverageAmount()
        {
            return AverageAmount;
        }

        public override int CalculateNumOfPerson()
        {
            return NumberOfUs;
        }

        public override void save()
        {
            Calculate();
            content.ActualFee = ActualFee;
            content.AverageAmount = AverageAmount;
            content.NumberOfUs = NumberOfUs;
            content.NumOfPerson = NumOfPerson;
            content.OurEmployee = OurEmployee;
            content.TotalAmount = TotalAmount;
            if (Id == Define.NEW)
            {
                Id = content.Insert(content);
            }
            else
            {
                content.Update(content);
            }
        }

        public override void load(int _id)
        {
            content = new tblTreatParty(_id);
            Id = _id;
            ActualFee = content.ActualFee;
            AverageAmount = content.AverageAmount;
            NumberOfUs = content.NumberOfUs;
            NumOfPerson = content.NumOfPerson;
            OurEmployee = content.OurEmployee;
            TotalAmount = content.TotalAmount;
        }

        public override string PRODUCT_NAME
        {
            get { return TreatType.Party.ToString(); }
        }
    }
}
